/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package entity.function;

/**
 *
 * @author dell
 */
public class Process 
{
public static class Node
{
//columns_______________________________________________________________________
private Node pnext;
private Object value;
//functions_____________________________________________________________________
     //operator_________________________________________________________________
public Node()
{ 
    
}
public Node(Object value)
{
     this.value=value;
}
     //getter___________________________________________________________________
public Object getValue()
{
     return value;
}
     //setter___________________________________________________________________
public void setValue(Object value) 
{
     this.value = value;
}
     //toString_________________________________________________________________
@Override
public String toString()
{
     return value.toString();
}
}    
//columns_______________________________________________________________________
private Node phead;
private Node ptail;
private String type;
private int size;
//functions_____________________________________________________________________
     //constructor______________________________________________________________
public Process()
{ 
     this.init();
}
public Process(String type)
{
     this.type=type;
     this.init();
}
     //getter___________________________________________________________________
public int getSize()
{
     return this.size;
}   
public String getType()
{
     return this.type;
}

     //setter___________________________________________________________________
public void setType(String type) 
{
     this.type = type;
}
     //checker__________________________________________________________________
public boolean isEmpty()
{
     if(this.size==0||this.phead==null) return true;
     return false;
     
}   
     //operator_________________________________________________________________
private void init()
{
     this.phead=this.ptail=new Node();
     this.size=0;
}
public void insert(Object value)
{
     this.ptail.setValue(value);
     this.ptail.pnext=new Node();
     this.phead=this.phead.pnext;
     this.size++;
}
public void remove()
{
     if(this.isEmpty()) return;
     this.phead=this.phead.pnext;
     this.size--;
}
public Object Pop()
{
     Object value=this.phead;
     this.remove();
     return value;
}
     //toString________________________________________________________________
@Override
public String toString()
{
     String str=type+"\t"+size;
     for(Node head=this.phead;head!=null;head=head.pnext)
     {
          str+="\t"+head.value;
     }
     return str;
}
}
